package com.beiding.controller.feign;

import com.beiding.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feign")
public class FeignRestController {


    private UserService userService;

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/email/get")
    String getEmail(String username) {
        return userService.getEmail(username);
    }


    @PostMapping("/email/check")
    boolean checkEmail(String username, String email) {
        String e = userService.getEmail(username);
        return email.equals(e);
    }


}
